/*
 * main.cc
 *
 *  Created on: Dec 2, 2010
 *      Author: fify
 */

#include "jlib.h"
#include "print.h"
#include <iostream>
#include <pthread.h>
#include <cstdlib>
#include <unistd.h>
#include <stdio.h>
using namespace std;

void *start_olive(void *unused)
{
	execl("/usr/bin/qemu-system-x86_64", "", "-hda", "/home/fify/vm/images/Olive_20.qcow2", "-net", "nic,model=e1000,macaddr=DE:AD:BE:EF:24:20", "-net", "nic,model=e1000,macaddr=DE:AD:BE:EF:16:20", "-net", "nic,model=e1000,macaddr=DE:AD:BE:EF:3E:20", "-net", "tap", "-m", "256", "-serial", "tcp::12321,server,nowait", (const char*)0);

	printf("Test\n");
	return NULL;
}

int main()
{
	char cmd[1024] = {"interface 0 10.0.7.9 30 DE:AD:BE:EF:24:10\r\n"
			"route 10.60.1.16 24 0 10.0.7.8\r\n"
			"route 10.60.3.16 24 0 10.0.7.9\r\n"
	};

	pthread_t tid;

	if(fork() == 0)
		pthread_create(&tid, NULL, &start_olive, NULL);

	cout << CncrJConfig::jconfig((char*)"root", (char*)"fify2010", (char*)"127.0.0.1", 12321, (char*)cmd, 10) << endl;
	return 0;
}
